#!/bin/#!/usr/bin/env bash

_file=$1$3
if [ ! -d $1 ]; then
  mkdir -p "$1"
fi

if [ ! -f $_file ]; then
    echo "===============cp no such file cp... ==============="
    cp $2 $1
else
    # 先删掉jar
    cd $1 && rm -f $3 && cp $2 $1
    # 杀掉进程
    pid=$(ps -ef | grep $3 | grep '/bin/java' | grep -v grep | awk '{print $2}')
    for i in $pid
    do
        echo "the process [ $i ] is running to sand kill "
        kill $i
        echo "killed process [ $i ]"
    done
    #cd $1 && nohup java -jar $3 &
fi


